//
//  ZYPBOperationIDMgr.m
//  ZYWebImage
//
//  Created by wangzhipan on 2025/4/30.
//

#import "ZYPBOperationIDMgr.h"

@interface ZYPBOperationIDMgr()
@property (nonatomic, strong, nullable) NSLock *idLock;

@property (nonatomic, assign) uint32_t opId;
@end

@implementation ZYPBOperationIDMgr
- (instancetype)init
{
    if (self = [super init]) {
        self.opId = arc4random() % 10000000  + 999999;
    }
    return self;
}

- (uint32_t)nextID
{
    uint32_t nextId = 0;
    [self.idLock lock];
    nextId = self.opId;
    self.opId++;
    [self.idLock unlock];
    return nextId;
}
@end
